<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ajax测试程序</title>
<script type="text/javascript">
	var xmlHttp;
	
	function showMsg(){
		createXMLHttp();		
		xmlHttp.onreadystatechange=showMsgCallback;
		xmlHttp.open("POST","content.html",true);
		xmlHttp.send();
	}
	function createXMLHttp(){
		if (window.XMLHttpRequest){	//  IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
			xmlHttp=new XMLHttpRequest();
		}else{	// IE6, IE5 浏览器执行代码
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	function showMsgCallback(){
		if (xmlHttp.readyState==4 && xmlHttp.status==200)
		{
			document.getElementById("msg").innerHTML=xmlHttp.responseText;
		}
	}
</script>
</head>
<body>

			
		<input type="button" onclick="showMsg()" value="调用Ajax显示内容">
		<span id="msg"></span>
		
</body>
</html>